<?php
	session_start();	
?>

<?php
	if( $_SESSION["admin"] != "" )
	{
?>
<a href="index.php?com=attribute"><b>List attribute</b></a> | <a href="index.php?com=attribute&func=add"><b>Add new attribute</b></a>
<br />
<?php
	include_once("process/attribute.php");	
	$attribute = new attribute();	
	$pager = new PS_Pagination($attribute->_connection, $attribute->GetListPaging(), 15, 5, "", "?com=attribute");
	
	$rs = $pager->paginate();

	$table = '<table width="70%" style="font-size:10pt;">
				<tr>
					<td align="center" colspan="10" height="50"><b style="font-size:12pt; color:Blue;">List attribute</b></td>
				</tr>
				<tr bgcolor="#996699" style=" font-weight:bold;">						
					<td style="padding:4px;">ProductNo</td>
                    <td style="padding:4px;">SKU</td>
                    <td style="padding:4px;">Attribute</td>
                    <td style="padding:4px;">Price</td>
                    <td style="padding:4px;">Cost</td>
                    <td style="padding:4px;">Quantity</td>
                    <td style="padding:4px;">Unit</td>
                     <td style="padding:4px;">ContainerCode</td>
					<td style="padding:4px;" align="center" width="70px" colspan="2"></td>
				</tr>';
        while($list = mysql_fetch_assoc($rs))
	{
	   $date = date('d/m/Y', $list['CreatedDate']);
		$table .= '	<tr bgcolor="#FFFFFF"  onMouseOver="this.bgColor = '."'#C0C0C0'".'" onMouseOut ="this.bgColor = '."'#FFFFFF'".'">
						
						<td style="padding:4px;">
							'.$list['ProductNo'].'
						</td>
                        	
						<td style="padding:4px;">
							'.$list['SKU'].'
						</td>
                        <td style="padding:4px;">
							'.$list['Attribute'].'
						</td>
                        <td style="padding:4px;">
							'.$list['Price'].'
						</td>
                        	<td style="padding:4px;">
							'.$list['Cost'].'
						</td>
                         <td style="padding:4px;">
							'.$list['Quantity'].'
						</td>
                        <td style="padding:4px;">
							'.$list['Unit'].'
						</td>
                         <td style="padding:4px;">
							'.$list['ContainerCode'].'
						</td>
						<td align="center">
							<a style="color:#0033FF;" href="index.php?com=attribute&func=update&id='.$list['AttributeID'].'">
								Update
							</a>
						</td>
						<td align="center">
							<a onClick="'."return confirm('Do you want to delete this attribute ?')".'"  style="color:#0033FF" href="index.php?com=attribute&func=delete&id='.$list['AttributeID'].'">
								Delete
							</a>
						</td>
					</tr>';
            }
	$table .= '</table>';
	echo $table.'<br />';
	echo $pager->renderFullNav();
     }
   else
	{
		echo "<meta http-equiv='refresh' content='0; url=login.php' />";
	}

?>